<template>
    <h1>我的任务</h1>
    <el-button @click="changeP">改变人员</el-button>
    <task :name="user.name" :age="user.age" @onEmitBack="backvalue" ref="box"/>
    <h3>id:{{id}}</h3>
</template>
<script lang="ts" setup>
import {onMounted, ref, watch} from 'vue'
import task from './task.vue'
const box = ref(null)
onMounted(()=>{
console.log('tatatatta',box.value)
})

const user = ref({
    name:'李四',age:100
})
let id = ref(0)
function changeP(){
    user.value={name:'王五',age:1000}
}
watch(
    user,(val,preval)=>{
        console.log('val',val)
    }
)
function backvalue(p:any){
    console.log('ppppp',p)
    id.value = p.id
}

</script>
